import {createBrowserRouter} from "react-router-dom";
import {lazy, Suspense} from "react";
import Index from "../pages/index";


// 路由懒加载
const PriceRecommend = lazy(() => import('../pages/priceRecommend'))
const Home = lazy(() => import('../pages/home'))
const CateShopList = lazy(() => import('../pages/cateShopList'))
const MarkerShopList = lazy(() => import('../pages/markerShopList'))

const router = createBrowserRouter([
    {
        path: "/",
        element: <Index/>,
        children: [
            {
                index: true,
                // path: "/home",
                element: <Suspense fallback={"加载中..."}><Home/></Suspense>,
            },
            {
                path: "/priceRecommend",
                element: <Suspense fallback={"加载中..."}><PriceRecommend/></Suspense>,
            },
            {
                path: "/cateShopList/:pName/:childName/:id",
                element: <Suspense fallback={"加载中..."}><CateShopList/></Suspense>,
            },
            {
                path: "/markerShopList/:cateName/:marketName/:id",
                element: <Suspense fallback={"加载中..."}><MarkerShopList/></Suspense>,

            },
        ]
    },


]);
export default router;